<%-- 
    Document   : login
    Created on : Mar 29, 2012, 11:35:14 PM
    Author     : Ethan
--%>
<%@page import="edu.uta.tsrh.db.*"%> 
<%@page import="edu.uta.tsrh.model.User"%> 
<%@page import="javax.servlet.http.HttpSession"%>

<% 

String username = (String)request.getParameter("login_username");
String password = (String)request.getParameter("login_password");

MySQLDBServices dbservices = new MySQLDBServices();
User user = dbservices.loginUser(username, password);

if(user != null) {
    
    session.setAttribute("user", user.getUserName());
}
else {
    session.setAttribute("login_error", "Invalid Credentials");
}

response.sendRedirect(request.getHeader("referer"));

%>
